TextField
The TextField component in the Scripting app provides a declarative way to create a text input field, similar to SwiftUI’s TextField. It supports both single-line and multiline input, custom labels, placeholder prompts, scroll direction, focus handling, and line constraints.
This component is ideal for collecting short inputs like usernames or longer inputs like messages, with seamless integration into reactive view hierarchies.
Props
Property Details
Example: Multiline, Vertically Scrollable TextField
Behavior
- The field grows from 3 to 8 lines in height as text is entered.
- When content exceeds 8 lines, it becomes scrollable.
- The
promptis shown as placeholder text until input is provided.
Example: Basic Single-Line TextField
Notes
- You must provide either
titleorlabel, not both. - For multiline input, set
axis="vertical"and define alineLimit. TextFieldintegrates seamlessly with state hooks likeuseStateto enable real-time reactivity.- Focus and blur events are helpful for validating or tracking input behavior.
